<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 普通对象
    const obj = {
      id: 10001,
      name: 'Bit',
      age: 9
    }

    // json格式
    // const json = {
    //   "id": 10001,
    //   "name": "Bit",
    //   "age": 9
    // }

    // 序列化
    console.log(JSON.stringify(obj))


    const jsonStr = '{"id": 10001, "name": "Bit", "age": 9}'

    // 反序列化
    console.log(JSON.parse(jsonStr))


  </script>
</body>

</html>